package com.example.kt_fast.viewmodel

import com.example.kt_common.base.BaseViewModel
import com.example.kt_common.network.RespStateData
import com.example.kt_fast.bean.req.AddDriverInfoReq
import com.example.kt_fast.bean.resp.CarTreeBean
import com.example.kt_fast.bean.resp.UploadImgBean
import com.example.kt_fast.repo.FastRepo
import okhttp3.MultipartBody

/**
 * Created by 小陈 on 2025/3/25.
 * Time: 18:36.
 */
class FastViewModel(private val repo: FastRepo) : BaseViewModel() {

    var uploadImgData = RespStateData<UploadImgBean>()
    var addDriverInfoData = RespStateData<String>()
    var carTreeData = RespStateData<CarTreeBean>()
    fun uploadImgBean(part: MultipartBody.Part) {
        launch(block = {
            repo.uploadImg(part, uploadImgData)
        })
    }

    fun addDriverInfo(addDriverInfoReq: AddDriverInfoReq) {
        launch(block = {
            repo.addDriverInfo(addDriverInfoReq, addDriverInfoData)
        })
    }
    fun getTreeAside() {
        launch(block = {
            repo.getTreeAside(carTreeData)
        })
    }
}